#include <bits/stdc++.h>

using namespace std;

int n,r,disans,ans;
int a[100010],cnt[100010],qian[100010];
bool f[100010];

int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        cnt[a[i]]++;
    }
    sort(a,a+n);
    for(int i=2;i<n;i++)
    {
        for(int j=1;j<a[i];j++)
        {
            if(cnt[j]!=0)
            {
                cnt[j]--;
                disans++;
                break;
            }
        }
    }
    ans=n-disans;
    cout<<ans<<endl;
    return 0;
}
